import request from "@/utils/request";

const modules = {
  //登录
  login: (params) =>
    request({
      method: "get",
      params,
      url: "/user/login",
    }),
  //获取用户信息
  getInfo: () =>
    request({
      method: "get",
      url: "/carMall/getInfo",
    }),
  //文件上传
  upload: (data) =>
    request({
      method: "post",
      url: "/oss/picUpload",
      data,
    }),
  //获取首页分类
  gethomeCategory: (params) =>
    request({
      url: "/category/list",
      method: "get",
      params,
    }),
  //获取首页商品
  getHomeGoods: (params) =>
    request({
      method: "get",
      url: "/goods/page",
      params,
    }),
  //获取首页轮播图
  getHomeBannerList: (params) =>
    request({
      method: "get",
      params,
      url: "/homepage/getSlideshow",
    }),
  //新增维权
  addComplaint: (data) =>
    request({
      method: "post",
      data,
      url: "/complaint/add",
    }),
  //搜索
  search: (params) =>
    request({
      method: "get",
      params,
      url: "/search/goods",
    }),
  //搜索记录
  searchhistory: () =>
    request({
      method: "get",
      url: "/search/history/list",
    }),
  //搜索热词
  searchHotWords: (params) =>
    request({
      method: "get",
      params,
      url: "/search/hotWords/page",
    }),
  //清空搜索记录
  delAllSearchHistory: () =>
    request({
      method: "post",
      url: "/search/history/clear",
    }),
  // 提交维权
  submitWeiquan: (data) =>
    request({
      method: "post",
      data,
      url: "/complaint/add",
    }),
  //获取维权列表
  getWeiquanList: (params) =>
    request({
      method: "get",
      params,
      url: "/complaint/page",
    }),
  //获取维权文章
  getWeiquanArticle: (params) =>
    request({
      method: "get",
      params,
      url: "/article/page",
    }),
};

export default modules;
